package zy.test.graphics;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.ViewGroup.LayoutParams;

public class GraphicsUseActivity extends Activity {

	MyView2 view;
	boolean create=false;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //Log.w("tid", "ui:"+Thread.currentThread().getId());
        create=true;
        //setContentView(new GameView(this));
        LayoutParams lay=new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        addContentView(new MyView(this),lay);
        
        view=new MyView2(this);
        //addContentView(view,lay);
        Handler handler=new Handler()
        {
        	@Override
        	public void handleMessage(Message msg) {
        		super.handleMessage(msg);
        		if(create)
        		sendEmptyMessageDelayed(0, 10);
        		
        		view.invalidate();
        		System.out.println("handle message,"+create);
        	}
        };
        //handler.sendEmptyMessage(0);
    }
    
    @Override
    protected void onPause() {
    	super.onPause();
    }
    
    @Override
    protected void onDestroy() {
    	super.onDestroy();
    	Log.w("d", "destroy");
    	create=false;
    }
}